/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Pokemons;

import Pokemons.Pokemon;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.util.ArrayList;
import javax.swing.ImageIcon;
import javax.swing.JPanel;
import Missiles.WaterMissile;

/**
 * Autores:
 * Hugo Hiroshi Yamamura
 * Marina Coimbra Viviani
 * 
 * Classe Squirtle
 * Pokemon com propriedade de água.
 */
public class Squirtle extends Pokemon {
    
    private String pokemon = "/Sprites/squirtle.gif";
    private int type = 1;
    
    
 /**
 * Construtor: Squirtle
 * @param coordenada x na qual deseja-se inserir o novo pokemon;
 * @param2 coordenada y na qual deseja-se inserir o novo pokemon
 */
    public Squirtle(int x, int y){
        ImageIcon ii = new ImageIcon(this.getClass().getResource(pokemon));
        this.setImage(ii.getImage());
        this.setX(x);
        this.setY(y);
        this.setImage(ii.getImage());
        this.setWidth(this.getImage().getWidth(null));
        this.setHeight(this.getImage().getHeight(null));
        this.setMissiles(new ArrayList());
        this.type = 1;
        this.setImagew(27);
        this.setVisible(true);
    }

     /*
    * 
    * Metodo: paint
    * Funcionamento: pinta o pokemon no JPanel.
    */
    @Override
    public void paint(Graphics g, JPanel panel){
        if(this.isVisible()){
            Graphics2D g2d = (Graphics2D)g;
            g2d.drawImage(this.getImage(), this.getX(), this.getY(), this.getX()+ this.getImagew(), this.getY() + this.getHeight(), this.getImagex1(), 0, this.getImagex1()+ this.getImagew(), this.getHeight(), panel);
        }
    }
    
     /*
    * 
    * Metodo: fire
    * lança misseis de água.
    */
    @Override
    public void fire() {
        this.getMissiles().add(new WaterMissile(this.getX() + this.getWidth(), this.getY() + this.getHeight()/2));
    }
    
}
